home *** CD-ROM | disk | FTP | other *** search
/ Photo Morph 2 / PhotoMorph 2.iso / cfg / vdsetup.mst < prev   
Text File  |  1996-07-03  |  15KB  |  541 lines

  1. '**************************************************************************
  2. '*       Videology Setup script  SIRIUS  7/03/96 11:00AM  KWG Pent133
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9. '$INCLUDE 'msregdb.inc'
  10.  
  11. CONST SW_SHOWMAXIMIZED=3
  12.  
  13. ''Dialog ID's
  14. CONST WELCOME       = 100    
  15. CONST ASKQUIT      = 200
  16. CONST DESTPATH     = 300
  17. CONST EXITFAILURE  = 400
  18. CONST EXITQUIT     = 600
  19. CONST EXITSUCCESS  = 700
  20. CONST OPTIONS      = 800
  21. CONST APPHELP      = 900
  22. CONST CUSTINST     = 6200
  23. CONST TOOBIG       = 6300
  24. CONST BADPATH      = 6400
  25.  
  26. ''Bitmap ID
  27. CONST LOGO         = 1
  28.  
  29. ''File Types
  30. CONST APPFILES     = 1
  31. CONST OPTFILES1    = 2
  32. CONST OPTFILES2    = 3
  33. CONST OPTFILES3    = 4
  34. CONST OPTFILES4    = 5
  35.  
  36.  
  37.  
  38. GLOBAL DEST$        ''Default destination directory.
  39. GLOBAL WINDRIVE$    ''Windows drive letter.
  40.  
  41.  
  42. ''CustInst list symbol names
  43. GLOBAL APPNEEDS$    ''Option list costs per drive
  44. GLOBAL OPT1NEEDS$
  45. GLOBAL OPT2NEEDS$
  46. GLOBAL OPT3NEEDS$
  47. GLOBAL OPT4NEEDS$
  48. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  49. GLOBAL BIGLIST$     ''List of option files cost calc results (boolean)
  50.  
  51. ''Dialog list symbol names
  52. GLOBAL CHECKSTATES$
  53. GLOBAL STATUSTEXT$
  54. GLOBAL DRIVETEXT$
  55. GLOBAL DRIVES$
  56. GLOBAL CD$
  57.  
  58. '' Windows version numbers
  59. GLOBAL MinorVer%
  60. GLOBAL Processor%
  61.  
  62.  
  63. DECLARE SUB AddOptFilesToCopyList (ftype%)
  64. DECLARE SUB RecalcOptFiles (ftype%)
  65. DECLARE SUB RecalcPath
  66. DECLARE SUB SetDriveStatus
  67. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  68. DECLARE FUNCTION ShowWindow  LIB "user.exe" (hWnd%,iShow%) AS INTEGER
  69.  
  70.  
  71. INIT:
  72.     
  73.     MinorVer% = GetWindowsMinorVersion()
  74.     WinSys$ = GetWindowsSysDir()
  75.  
  76. '' start of installation
  77.  
  78.     hWnd%=HwndFrame()
  79.     junk%=ShowWindow(hWnd%,SW_SHOWMAXIMIZED)
  80.     CUIDLL$ = "mscuistf.dll"            ''custom user interface dll
  81.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  82.  
  83.     SetBitmap CUIDLL$, LOGO
  84.     SetTitle "Setup Andover Videology"
  85.  
  86.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  87.     IF szInf$ = "" THEN
  88.         szInf$ = GetSymbolValue("STF_CWDDIR") + "VDSETUP.INF"
  89.     END IF
  90.     ReadInfFile szInf$
  91.  
  92.     WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  93.     DEST$ = WINDRIVE$ + ":\Videolgy"
  94.  
  95.     '' Obtain and display list of valid drives.
  96.     GetValidDrivesList "drives"
  97.     Drives$=GetSymbolValue ("drives")
  98.     ''pause Drives$
  99.  
  100.     '' Cycle through drive list and find CD drive.
  101.  
  102.     for i%=1 to GetListLength ("drives")
  103.       D$ = GetListItem ("drives", i)
  104.     IF IsDriveNetwork(D$) = 1 THEN
  105.       IF GetFreeSpaceForDrive(D$) = 0 THEN
  106.        IF DoesFileExist(D$ + ":\startup.exe",0) = 1 THEN
  107.         CD$ = D$
  108.        ENDIF
  109.       ENDIF
  110.     ENDIF
  111.     next
  112.  
  113.      ''CD$="D"
  114.  
  115.     IF CD$ = ""  THEN
  116.      i% = DoMsgBox("Setup was unable to locate Videology CD. Please make sure the CD is in CD drive then run setup again." , "Problem: Videology CD not detected.", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  117.      END
  118.     END IF
  119.  
  120.     ''CustInst list symbols
  121.     CHECKSTATES$ = "CheckItemsState"
  122.     STATUSTEXT$  = "StatusItemsText"
  123.     DRIVETEXT$   = "DriveStatusText"
  124.     FOR i% = 1 TO 5 STEP 1
  125.         AddListItem CHECKSTATES$, "ON"
  126.     NEXT i%
  127.  
  128.     FOR i% = 1 TO 5 STEP 1
  129.         AddListItem STATUSTEXT$, ""
  130.     NEXT i%
  131.     FOR i% = 1 TO 7 STEP 1
  132.         AddListItem DRIVETEXT$, ""
  133.     NEXT i%
  134.     ReplaceListItem DRIVETEXT$, 7, DEST$
  135.  
  136.     ''Disk cost list symbols
  137.     APPNEEDS$   = "AppNeeds"
  138.     OPT1NEEDS$  = "Opt1Needs"
  139.     OPT2NEEDS$  = "Opt2Needs"
  140.     OPT3NEEDS$  = "Opt3Needs"
  141.     OPT4NEEDS$  = "Opt4Needs"
  142.     EXTRACOSTS$ = "ExtraCosts"
  143.     BIGLIST$    = "BigList"
  144.     FOR i% = 1 TO 5 STEP 1
  145.         AddListItem BIGLIST$, ""
  146.     NEXT i%
  147.     FOR i% = 1 TO 26 STEP 1
  148.         AddListItem EXTRACOSTS$, "0"
  149.     NEXT i%
  150.  
  151.  
  152.     RecalcPath
  153.     SetDriveStatus
  154.  
  155. '$IFDEF DEBUG
  156.     i% = SetSizeCheckMode(scmOff)    '' could use scmOff; def = scmOnFatal
  157. '$ENDIF ''DEBUG
  158.  
  159.  
  160. WELCOME:
  161.  
  162.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  163.     IF sz$ = "CONTINUE" THEN
  164.         UIPop 1
  165.         GOTO CUSTINST
  166.     ELSEIF sz$ = "REACTIVATE" THEN
  167.         GOTO WELCOME
  168.     ELSE
  169.         GOSUB ASKQUIT
  170.     GOTO WELCOME
  171.     END IF
  172.  
  173.  
  174. CUSTINST:
  175.     sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
  176.  
  177.     IF sz$ = "CONTINUE" THEN
  178.         ''Install only if it will fit.
  179.         FOR i% = 1 TO 5 STEP 1
  180.             IF GetListItem(BIGLIST$, i%) <> "" THEN
  181.                 GOSUB TOOBIG
  182.                 GOTO CUSTINST
  183.             END IF
  184.         NEXT i%
  185.         UIPop 1
  186.         GOTO INSTALL
  187.     ELSEIF sz$ = "PATH" THEN
  188.         GOTO GETPATH
  189.     ELSEIF sz$ = "CHK1" THEN
  190.         RecalcOptFiles APPFILES
  191.         SetDriveStatus
  192.         GOTO CUSTINST
  193.     ELSEIF sz$ = "CHK2" THEN
  194.         RecalcOptFiles OPTFILES1
  195.         SetDriveStatus
  196.         GOTO CUSTINST
  197.     ELSEIF sz$ = "CHK3" THEN
  198.         RecalcOptFiles OPTFILES2
  199.         SetDriveStatus
  200.         GOTO CUSTINST
  201.     ELSEIF sz$ = "CHK4" THEN
  202.         RecalcOptFiles OPTFILES3
  203.         SetDriveStatus
  204.         GOTO CUSTINST
  205.     ELSEIF sz$ = "CHK5" THEN
  206.         RecalcOptFiles OPTFILES4
  207.         SetDriveStatus
  208.         GOTO CUSTINST
  209.     ELSEIF sz$ = "REACTIVATE" THEN
  210.         RecalcPath
  211.         SetDriveStatus
  212.         GOTO CUSTINST
  213.     ELSE
  214.         GOSUB ASKQUIT
  215.         GOTO CUSTINST
  216.     END IF
  217.  
  218.  
  219.  
  220. INSTALL:
  221.  
  222.     IF GetListItem (CHECKSTATES$, 1) = "OFF" THEN
  223.     IF GetListItem (CHECKSTATES$, 2) = "OFF" THEN
  224.     GOSUB ASKQUIT
  225.     GOTO CUSTINST
  226.     ENDIF
  227.     ENDIF
  228.  
  229.     ClearCopyList
  230.     AddOptFilesToCopyList APPFILES
  231.     AddOptFilesToCopyList OPTFILES1
  232.     CreateDir DEST$, cmoNone
  233.     CopyFilesInCopyList
  234.  
  235.     CreateProgmanGroup "Videology", "", cmoNone
  236.     ShowProgmanGroup  "Videology", 1, cmoNone
  237.  
  238.     IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
  239.       CreateProgmanItem "Videology", "PhotoMorph 2", DEST$ + "\pmorph2\pmorph.exe ", "", cmoOverwrite
  240.     CreateProgmanItem "Videology", "Read Me", DEST$ + "\pmorph2\readme.wri", "", cmoOverwrite
  241.     CreateProgmanItem "Videology", "Upgrade Notice", DEST$ + "\pmorph2\upgrades.wri", "", cmoOverwrite
  242.     CreateProgmanItem "Videology", "User Manual on CD", CD$ + ":\manual\mviewer2 pm2man.mvb", "", cmoOverwrite
  243.     CreateProgmanItem "Videology", "Example Videos on CD", CD$ + ":\videos\movie.exe", "", cmoOverwrite
  244.     END IF
  245.  
  246.  
  247.     IF GetListItem(CHECKSTATES$, OPTFILES1) = "ON" THEN
  248.     CreateProgmanItem "Videology", "Video Action ED", DEST$ + "\vidactn\vawin.exe", "", cmoOverwrite
  249.     CreateProgmanItem "Videology", "Video Action Online User Guide", DEST$ + "\vidactn\vawin.hlp", "", cmoOverwrite
  250.     CreateProgmanItem "Videology", "Video Action Read Me", DEST$ + "\vidactn\readme.wri ", "", cmoOverwrite
  251.     END IF
  252.  
  253.     CopyFile CD$ + ":\pmorph2\unsetup.exe", DEST$ + "\unsetup.exe", cmoNone, 0
  254.     CopyFile CD$ + ":\pmorph2\unsetup.ini", DEST$ + "\unsetup.ini", cmoNone, 0
  255.     CreateProgmanItem "Videology", "Uninstall Videology", DEST$ + "\unsetup.exe ", "", cmoOverwrite
  256.  
  257.     IF MinorVer% < 90 THEN
  258.      IF DoesFileExist(WinSys$ + "avifile.dll", 0) = 0 THEN
  259.       i% = DoMsgBox("This software requires Video for Windows. Please run the 'Setup Video for Windows' program item in your Videology 3D group." , "Please note: Video for Windows not detected.", MB_OK+MB_TASKMODAL+MB_ICONINFORMATION)
  260.       CreateProgmanItem "Videology", "Setup Video for Windows", CD$ + ":\vfw11e\setup.exe ", "", cmoOverwrite
  261.      END IF
  262.     END IF
  263.  
  264.          IF DoesRegKeyExist ("AndoverPm2") = 0 THEN
  265.          RANDOMIZE TIMER
  266.          X% = RND
  267.      num$ = " " + "510" + STR$(X% + 777) + STR$(X%)
  268.      CreateRegKeyValue "AndoverPm2", num$
  269.      ELSE
  270.      num$ = GetRegKeyValue ("AndoverPm2")
  271.          END IF
  272.  
  273. QUIT:
  274.     ON ERROR GOTO ERRQUIT
  275.  
  276.     IF ERR = 0 THEN
  277.         dlg% = EXITSUCCESS
  278.     ELSEIF ERR = STFQUIT THEN
  279.         dlg% = EXITQUIT
  280.     ELSE
  281.         dlg% = EXITFAILURE
  282.     END IF
  283. QUITL1:
  284.     SetSymbolValue "EditTextIn", num$
  285.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FEditDlgProc", 0, "")
  286.     IF sz$ = "REACTIVATE" THEN
  287.         GOTO QUITL1
  288.     END IF
  289.     UIPop 1
  290.  
  291.     END
  292.  
  293. ERRQUIT:
  294.     i% = DoMsgBox("AJM Default Error: Source drive unreadable.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  295.     END
  296.  
  297.  
  298.  
  299. GETPATH:
  300.     SetSymbolValue "EditTextIn", DEST$
  301.     SetSymbolValue "EditFocus", "END"
  302. GETPATHL1:
  303.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  304.  
  305.     IF sz$ = "CONTINUE" THEN
  306.         olddest$ = DEST$
  307.         DEST$ = GetSymbolValue("EditTextOut")
  308.  
  309.         ''Validate new path.
  310.         IF IsDirWritable(DEST$) = 0 THEN
  311.             GOSUB BADPATH
  312.             GOTO GETPATHL1
  313.         END IF
  314.         UIPop 1
  315.  
  316.         ''Truncate display if too long.
  317.         IF LEN(DEST$) > 23 THEN
  318.             ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  319.         ELSE
  320.             ReplaceListItem DRIVETEXT$, 7, DEST$
  321.         END IF
  322.  
  323.         ''Recalc if path changed.
  324.         IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  325.             RecalcPath
  326.             SetDriveStatus
  327.         END IF
  328.  
  329.         olddest$ = ""
  330.         GOTO CUSTINST
  331.     ELSEIF sz$ = "REACTIVATE" THEN
  332.         RecalcPath
  333.         SetDriveStatus
  334.         GOTO GETPATHL1
  335.     ELSEIF sz$ = "EXIT" THEN
  336.         GOSUB ASKQUIT
  337.         GOTO GETPATHL1
  338.     ELSE
  339.         UIPop 1
  340.         GOTO CUSTINST
  341.     END IF
  342.  
  343.  
  344. TOOBIG:
  345.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  346.     IF sz$ = "REACTIVATE" THEN
  347.         RecalcPath
  348.         SetDriveStatus
  349.         GOTO TOOBIG
  350.     END IF
  351.     UIPop 1
  352.     RETURN
  353.  
  354.  
  355.  
  356. BADPATH:
  357.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  358.     IF sz$ = "REACTIVATE" THEN
  359.         RecalcPath
  360.         SetDriveStatus
  361.         GOTO BADPATH
  362.     END IF
  363.     UIPop 1
  364.     RETURN
  365.  
  366.  
  367.  
  368. ASKQUIT:
  369.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  370.  
  371.     IF sz$ = "EXIT" THEN
  372.         UIPopAll
  373.         ERROR STFQUIT
  374.     ELSEIF sz$ = "REACTIVATE" THEN
  375.         GOTO ASKQUIT
  376.     ELSE
  377.         UIPop 1
  378.     END IF
  379.     RETURN
  380.  
  381.  
  382.  
  383. '**
  384. '** Purpose:
  385. '**     Adds the specified option files to the copy list.
  386. '** Arguments:
  387. '**     ftype%  - type of files to add, one of the following:
  388. '**             APPFILES, OPTFILES1, OPTFILES2
  389. '** Returns:
  390. '**     none.
  391. '*************************************************************************
  392. SUB AddOptFilesToCopyList (ftype%) STATIC
  393.  
  394.     IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
  395.         SrcDir$ = GetSymbolValue("STF_SRCDIR")
  396.         IF ftype% = APPFILES THEN
  397.             AddSectionFilesToCopyList "AppFiles", SrcDir$, DEST$
  398.         ELSEIF ftype% = OPTFILES1 THEN
  399.             AddSectionFilesToCopyList "OptFiles1", SrcDir$, DEST$
  400.         END IF
  401.         SrcDir$ = ""
  402.     END IF
  403. END SUB
  404.  
  405.  
  406. '**
  407. '** Purpose:
  408. '**     Recalculates disk space for the given option files and sets
  409. '**     the status info symbol "StatusItemsText".
  410. '** Arguments:
  411. '**     ftype% - type of files to add, one of the following:
  412. '**             APPFILES, OPTFILES1, OPTFILES2
  413. '** Returns:
  414. '**     none.
  415. '*************************************************************************
  416. SUB RecalcOptFiles (ftype%) STATIC
  417.     CursorSave% = ShowWaitCursor()
  418.     ClearCopyList
  419.     AddOptFilesToCopyList ftype%
  420.  
  421.     fExtra% = 0
  422.     IF ftype% = APPFILES THEN
  423.         ListSym$ = APPNEEDS$
  424.     ELSEIF ftype% = OPTFILES1 THEN
  425.         ListSym$ = OPT1NEEDS$
  426.     END IF
  427.  
  428.     WinSys$ = GetWindowsSysDir()
  429.     IF MinorVer% < 90 THEN
  430.      IF DoesFileExist(WinSys$ + "avifile.dll", 0) = 0 THEN
  431.             ''Add extra cost to Windows drive for ini/progman, etc.
  432.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  433.             ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
  434.             fExtra% = 1
  435.         END IF
  436.        END IF
  437.  
  438.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  439.  
  440.     cost& = 0
  441.     FOR i% = 1 TO 26 STEP 1
  442.         cost&  = cost& + VAL(GetListItem(ListSym$, i%))
  443.     NEXT i%
  444.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  445.  
  446.     IF StillNeed& > 0 THEN
  447.         ReplaceListItem BIGLIST$, ftype%, "YES"
  448.     ELSE
  449.         ReplaceListItem BIGLIST$, ftype%, ""
  450.     END IF
  451.  
  452.     IF fExtra% THEN
  453.         ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  454.     END IF
  455.     RestoreCursor CursorSave%
  456.     ListSym$ = ""
  457. END SUB
  458.  
  459.  
  460. '**
  461. '** Purpose:
  462. '**     Recalculates disk space and sets option status info according
  463. '**     to the current destination path.
  464. '** Arguments:
  465. '**     none.
  466. '** Returns:
  467. '**     none.
  468. '*************************************************************************
  469. SUB RecalcPath STATIC
  470.  
  471.     CursorSave% = ShowWaitCursor()
  472.  
  473.     RecalcOptFiles APPFILES
  474.     RecalcOptFiles OPTFILES1
  475.  
  476.     RestoreCursor CursorSave%
  477. END SUB
  478.  
  479.  
  480. '**
  481. '** Purpose:
  482. '**     Sets drive status info according to latest disk space calcs.
  483. '** Arguments:
  484. '**     none.
  485. '** Returns:
  486. '**     none.
  487. '*************************************************************************
  488. SUB SetDriveStatus STATIC
  489.  
  490.     drive$ = MID$(DEST$, 1, 1)
  491.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  492.     cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(OPT1NEEDS$, ndrive%))
  493.     free& = GetFreeSpaceForDrive(drive$)
  494.     ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
  495.     ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  496.     ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  497.  
  498.     IF drive$ = WINDRIVE$ THEN
  499.         ReplaceListItem DRIVETEXT$, 4, ""
  500.         ReplaceListItem DRIVETEXT$, 5, ""
  501.         ReplaceListItem DRIVETEXT$, 6, ""
  502.     ELSE
  503.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  504.         cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(OPT1NEEDS$, ndrive%))
  505.         IF cost& = 0 THEN
  506.             ReplaceListItem DRIVETEXT$, 4, ""
  507.             ReplaceListItem DRIVETEXT$, 5, ""
  508.             ReplaceListItem DRIVETEXT$, 6, ""
  509.         ELSE
  510.             free& = GetFreeSpaceForDrive(WINDRIVE$)
  511.             ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
  512.             ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
  513.             ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
  514.         END IF
  515.     END IF
  516. END SUB
  517.  
  518.  
  519. '**
  520. '** Purpose:
  521. '**     Appends a file name to the end of a directory path,
  522. '**     inserting a backslash character as needed.
  523. '** Arguments:
  524. '**     szDir$  - full directory path (with optional ending "\")
  525. '**     szFile$ - filename to append to directory
  526. '** Returns:
  527. '**     Resulting fully qualified path name.
  528. '*************************************************************************
  529. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  530.     IF szDir$ = "" THEN
  531.         MakePath = szFile$
  532.     ELSEIF szFile$ = "" THEN
  533.         MakePath = szDir$
  534.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  535.         MakePath = szDir$ + szFile$
  536.     ELSE
  537.         MakePath = szDir$ + "\" + szFile$
  538.     END IF
  539. END FUNCTION
  540.  
  541.